#ifndef TASKTHREAD_H
#define TASKTHREAD_H

#include <QObject>
#include <QThread>
#include <QGraphicsScene>
#include <QGraphicsItem>
#include <QGraphicsPixmapItem>

#include "taskwindow.h"

class taskThread : public QThread
{
    Q_OBJECT
public:
    taskThread();
    void run() override;

    QGraphicsScene* getScene() {return &m_scene;}
    QVector<QPair<QString, QPixmap>>* getImgs() {return &m_Imgs;}
    int getIndex() {return m_index;}
    bool getFlag() {return m_flag;}
    bool getDeal() {return m_deal;}
    int getNum() {return m_Num;}

    void setIndex(int index) {m_index = index;}
    void setFlag(bool flag) {m_flag = flag;}
    void setDeal(bool deal) {m_deal = deal;}
    void setNum(int num) {m_Num = num;}
    void setTaskWindow(TaskWindow* taskwindow) {if(m_taskwindow) delete m_taskwindow; m_taskwindow = taskwindow;}

signals:
    void updateScene(int Num);

public slots:
    void dealTask();

private:
    int m_index = 0;                            //  当前选择的图片索引
    QVector<QPair<QString, QPixmap>> m_Imgs;    //  图片路径：图片源
    QGraphicsScene m_scene;                     //  场景
    bool m_flag = false;                        //  执行切换图片的标志
    bool m_deal = false;                        //  执行任务的标志
    TaskWindow* m_taskwindow = nullptr;         //  任务窗口
    int m_Num;                                  //  线程编号
};

#endif // TASKTHREAD_H
